/** 
 *  @file
 *  @brief   线性静力学求解器
 *  @author  wanghuan
 *  @date    2024.03.25
 *  @version  v1.0
 *  @par Copyright(c):  ShenGong  Simulation corporation
 */

#pragma once

#include <set>
#include "DataStructure/Common/Out.h"
#include "DataStructure/Common/Id.h"
#include "DataStructure/Input/Solver/Project.h"
#include "DBManager/DBServiceFactory.h"
#include "../Common/TaskExport.h"
#include "SGFem/Task/Kernel/MModel.h"

/** 
 * @brief 计算相同边界条件下多个静力工况结果
 *
 *  避免刚度方程的重复组装和分解
 */
class Task_DECLSPEC StaticSolver
{
public:
    StaticSolver ();
    ~StaticSolver ();
private:
    StaticSolver (const StaticSolver&);
    StaticSolver& operator= (const StaticSolver&);
    
public:
    /** @brief 计算指定工况的位移
     * 
     * 计算单个工况的右端项，并回代计算当前工况的位移
    */
    void Solve (const Kernel::MModel& model, const SG::DataStructure::Common::Id loadId, _OUT std::vector<SG::DataStructure::Common::Real>& displacement);

    /** @brief 计算一组相同边界条件的静力位移
     * 
     * 首先，完成刚度矩阵的组装【如果使用直接法求解线性方程组，先完成矩阵的三角分解】
     * 
     * 遍历工况号，调用重载函数计算单个工况的右端项
     */
    void Solve (const SG::DBManager::DBServiceFactorySP dbServiceFactory, const SG::DataStructure::FEM::Project& project, const SG::DataStructure::Common::IdArray& ids);

private:
    class Impl;
    Impl* m_impl;
};